<template>
  <div>
    <el-dialog
      title="查看批阅"
      :visible.sync="addEditIsDialog_c"
      :close-on-click-modal="false"
      @close="resetForm('formName')"
      width="800px"
    >
      <el-form
        :model="ruleForm"
        :rules="rules"
        ref="formName"
        label-width="140px"
        class="demo-ruleForm"
        :class="{ 'form-rules-show': seeType }"
      >
        <el-row>
          <el-col :span="24">
            <el-form-item label="批阅分数：" prop="score">
              <el-input
                v-model="ruleForm.score"
                placeholder="请输入批阅分数"
                clearable
                maxlength="50"
                show-word-limit
                :disabled="seeType"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="批阅评阅：" prop="comment">
              <el-input
                v-model="ruleForm.comment"
                placeholder="请输入批阅评阅"
                clearable
                maxlength="100"
                show-word-limit
                :disabled="seeType"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="批阅老师：" prop="teacherName">
              <el-input
                v-model="ruleForm.teacherName"
                placeholder="请输入批阅评阅"
                clearable
                maxlength="50"
                show-word-limit
                :disabled="seeType"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="批阅时间：" prop="createDate">
              <el-input
                v-model="ruleForm.createDate"
                placeholder="请输入批阅评阅"
                clearable
                maxlength="50"
                show-word-limit
                :disabled="seeType"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="resetForm('formName')">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script type="text/ecmascript-6">
import { getDataDeviceExperimentComment } from "@/api/statistic";

export default {
  components: {},
  props: {
    addEditId: {
      type: String,
      default: "",
    },
    addEditStatus: {
      type: String,
      default: "add",
    },
    addEditIsDialog: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      ruleForm: {
        // 表单字段
        id: "",
        score: "",
        comment: "",
        teacherName: "",
        createDate: "",
      },
      rules: {
        // 表单规则
      },
      addEditIsDialog_c: false, // 弹窗是否显示
      seeType: false, // 是否禁用
    };
  },
  watch: {
    addEditIsDialog(val) {
      this.addEditIsDialog_c = val;
      if (this.addEditIsDialog_c) {
        this.ruleForm.id = this.addEditId;
        this.seeType = true;
        this.getDetail();
      }
    },
  },
  methods: {
    // 详情
    getDetail() {
      getDataDeviceExperimentComment({ id: this.addEditId }).then((res) => {
        if (res.code == 200) {
          this.ruleForm = res.data;
        }
      });
    },

    // 取消
    resetForm(formName) {
      this.$refs[formName].resetFields();
      this.$parent.closeAddEdit();
    },
  },
};
</script>

<style lang="less" scoped>
.demo-ruleForm {
  width: 95%;
  margin: 0 auto;
  padding-top: 10px;

  .el-input-number {
    width: 100%;
  }
}
</style>
